<?php

App::uses('AppModel', 'Model');

class Partner extends AppModel {
	
	public $name = "Partner";
	public $order = "Partner.position";
	
	public function afterFind($results, $primary=false) {
		foreach($results as &$result) {
			$result[$this->name]['slug'] = urlize($result[$this->name]['name']);
			$result[$this->name]['site'] = $result[$this->name]['url'];
			$result[$this->name]['url'] = "http://www." . preg_replace('/^[fh]t+ps?:\/\/www\./', '', $result[$this->name]["url"]);
			$result[$this->name]['image_color'] = preg_replace('/\.(.*?)/', '.hover.$1', $result[$this->name]["image"]);
		}
		return $results;
	}
	
}